package com.linzt.candy.wxmp.rest;

import com.linzt.candy.common.core.utils.poi.ExcelUtil;
import com.linzt.candy.common.core.web.controller.BaseController;
import com.linzt.candy.common.core.web.domain.AjaxResult;
import com.linzt.candy.common.core.web.page.TableDataInfo;
import com.linzt.candy.wxmp.domain.WxMpInfo;
import com.linzt.candy.wxmp.service.IWxMpInfoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @Author linzt
 * @Date 2020/12/218:40 下午
 * @Description 微信公众号管理
 * @Version 1.0
 */
@RestController
@RequestMapping("/wxMpInfo")
public class WxMpInfoController extends BaseController {

    @Resource
    private IWxMpInfoService wxMpInfoService;

    @GetMapping("/list")
    public TableDataInfo getWxMps(WxMpInfo wxMpInfo) {
        startPage();
        List<WxMpInfo> list = wxMpInfoService.selectToList(wxMpInfo);
        return getDataTable(list);
    }

    @PostMapping("/export")
    public void export(HttpServletResponse response, WxMpInfo wxMpInfo) throws IOException {
        List<WxMpInfo> list = wxMpInfoService.selectToList(wxMpInfo);
        ExcelUtil<WxMpInfo> util = new ExcelUtil<WxMpInfo>(WxMpInfo.class);
        util.exportExcel(response, list, "微信公众号数据");
    }


}
